package com.yootk.listener;

import jakarta.servlet.ServletRequestEvent;
import jakarta.servlet.ServletRequestListener;
import jakarta.servlet.http.HttpServletRequest;

/**
 * Request请求监听
 */
public class RequestStateMonitor implements ServletRequestListener {

    @Override
    public void requestInitialized(ServletRequestEvent sre) { // 请求初始化
        System.out.println("【RequestStateMonitor.requestInitialized()】Request请求地址：" + ((HttpServletRequest) sre.getServletRequest()).getRequestURL());
    }

    @Override
    public void requestDestroyed(ServletRequestEvent sre) { // 请求销毁
        System.out.println("【RequestStateMonitor.requestDestroyed()】Request请求处理完毕。");
    }
}
